﻿using Microsoft.EntityFrameworkCore;

namespace Dyao.Book.Repository.Shared
{
    /// <summary>
    ///  ModelBuilder 扩展
    /// </summary>
    public static class ModelBuilderExtension
    {
        /// <summary>
        /// 禁用unicode ID列 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <typeparam name="TParams"></typeparam>
        /// <param name="modelBuilder">modelBuilder</param>
        /// <param name="columnName">列名</param>
        public static void DisableUnicodeIdColumn(this ModelBuilder modelBuilder)
        {
            //var properties = modelBuilder.Model.GetEntityTypes().SelectMany(a => a.GetProperties());
            //var dateTypes = properties.Where(a => a.ClrType == typeof(string) &&
            //                                                                     a.PropertyInfo.Name == "Id" && a.GetColumnType() == null);

            //foreach (var item in dateTypes)
            //{
            //    item.SetIsUnicode(false);
            //}
        }

    }
}
